import java.io.Serializable;

public class Frame implements Serializable {
    private int row = 9;
    private int line = 9;
    String[][] frame = new String[row][line];


    public Frame() {
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < line; j++) {
                if ((i % 2) == 1) {
                    if ((j % 2) == 0) {
                        frame[i][j] = "|";
                    } else {
                        frame[i][j] = "      ";
                    }
                } else {
                    if ((j % 2) == 0) {
                        frame[i][j] = "-";
                    } else {
                        frame[i][j] = "------";
                    }
                }
            }
        }
    }

    public void setCube(Cube cube) {
        for (int i = 1, is = 0; i < row && is < 4; i += 2, is++) {
            for (int j = 1, js = 0; j < line && js < 4; j += 2, js++) {
                frame[i][j] = String.valueOf(cube.getEachCube(is, js));
            }
        }
    }

    public int[][] getCopyCube(Cube cube){
        int[][] copyCube=new int[4][4];
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                copyCube[i][j]=cube.getEachCube(i,j);
            }
        }
        return copyCube;
    }


    public void printFrame(Cube cube) {
        setCube(cube);
        for (String[] k : frame) {
            for (String ks : k)
                if (ks.equals("|") || ks.equals("-") || ks.equals("------")) {
                    System.out.printf(ks);
                } else {
                    if (ks.equals("0")) {
                        System.out.print(String.format("%-6s", " "));
                    } else {
                        System.out.print(String.format("%-6s", ks));
                    }
                }
            System.out.println();
        }
    }


}
